if(!jsx3.lang.Class.forName("tibco.admin.environments.keystore.KeystorePlugin")) {
    jsx3.lang.Package.definePackage("tibco.admin.enterpriseAssets.envDef.envDtls.keystore", function (envKeystorePak) {
    });

    jsx3.lang.Class.defineClass("tibco.admin.environments.keystore.KeystorePlugin",
            jsx3.lang.Object,
            [tibco.admin.environments.EnvironmentsInterface],
            function (envKeystore) {

                envKeystore.mtxList = null;
                envKeystore.environmentName = null
                envKeystore.entityID = null;
                envKeystore.nodeId = null;
                envKeystore.nodeName = null;
                envKeystore.version = null;
                envKeystore.instance = null;
                envKeystore.prototype.mainObject = null;

                envKeystore.prototype.init = function() {
                    tibco.admin.Main.loadResource("tibco/admin/environments/keystore/jss/jss.xml", "tibco.admin", "jss100", "ljss", false);
                    tibco.admin.Main.loadResource("tibco/admin/environments/keystore/jss/xslt.xml", "tibco.admin", "xslt100", "jss", false);
                }

                envKeystore.getInstance = function(args) {
                    if(!envKeystore.instance) {
                        envKeystore.instance = new tibco.admin.environments.keystore.KeystorePlugin();
                    }
                    return envKeystore.instance;
                };

                envKeystore.prototype.getNamespace = function() {
                    return "tibco.admin";
                };

                envKeystore.prototype.loadComponent = function(parent) {
                    tibco.admin.Main.loadUIResourceAsync(parent, this.getNamespace(), "tibco/admin/environments/keystore/ui/kList.xml", this, this.loadMainObject);
                };

                envKeystore.prototype.doCancelEdits = function() {
                    this.mainObject.cancelEditSettings();
                }

                envKeystore.prototype.getConfirmText = function() {
                    return tibco.admin.Main.getServer().getDynamicProperty("@@Confirm Discard Text100");
                }

                envKeystore.prototype.loadMainObject = function(objEvent) {
                    this.mainObject = objEvent.obj;
                    this.mainObject.editDisabled = (this.nodeState == "Starting");
                    this.mainObject.getDescendantOfName("btnEdit100").setEnabled(this.mainObject.editDisabled ? jsx3.gui.Form.STATEDISABLED : jsx3.gui.Form.STATEENABLED, true);
                    this.mainObject.pluginObj = this;

                    this.isEditMode = false;

                    if(this.nodeId) {
                        this.mainObject.loadDetails(this.envId, this.nodeId, this.nodeName);
                    }

                    this.strRadBtnYes = tibco.admin.Main.getServer().getDynamicProperty("@addin@radBtn Yes");
                    this.strRadBtnNo = tibco.admin.Main.getServer().getDynamicProperty("@addin@radBtn No");

                    var str = "<xsl:template xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"><xsl:if test=\"@associated\"><xsl:if test=\"@associated='true'\"><i>" + tibco.admin.Main.getServer().getDynamicProperty("@@hidden100") + "</i></xsl:if><xsl:if test=\"@associated='false'\"></xsl:if></xsl:if></xsl:template>";
                    this.mainObject.getDescendantOfName("mcPassword100").setValueTemplate(str);

                    this.mainObject.getDescendantOfName("mtxKeystoreList100").repaintData();

                }

                //interface method
                envKeystore.prototype.getButtonText = function(parent) {
                    return tibco.admin.Main.getServer().getDynamicProperty("@@lblKeystore100");
                }

                envKeystore.prototype.onAfterComponentUnloaded = function() {
                    if(this.isInEditMode()) {
                        this.endEditMode();
                    }
                    this.envId = null;
                    this.nodeId = null;
                    this.mainObject = null;
                }

                envKeystore.prototype.setEnvId = function(id) {
                    this.envId = id;
                }

                envKeystore.prototype.setNodeState = function(nodeState) {
                    this.nodeState = nodeState;
                    if(this.mainObject) {
                        this.mainObject.editDisabled = (this.nodeState == "Starting");
                        this.mainObject.getDescendantOfName("btnEdit100").setEnabled(this.mainObject.editDisabled ? jsx3.gui.Form.STATEDISABLED : jsx3.gui.Form.STATEENABLED, true);
                    }
                }

                envKeystore.prototype.setNodeIds = function(arrIds) {
                    if(this.isInEditMode()) {
                        if((arrIds && (arrIds.length == 1) && (arrIds[0] != this.nodeId)) || (this.nodeId && (!arrIds || (arrIds.length != 1)))) {
                            tibco.admin.Main.alert(tibco.admin.Main.getServer().getDynamicProperty("@@msgCannotUpdateNodeIdTitle100"), tibco.admin.Main.getServer().getDynamicProperty("@@msgCannotUpdateNodeIdMessage100"));
                        }
                        return;
                    }
                    if(arrIds && (arrIds.length == 1)) {
                        this.nodeId = arrIds[0];
                    }
                    else {
                        this.nodeId = null;
                    }
                    if(this.mainObject) {
                        this.mainObject.loadDetails(this.envId, this.nodeId, this.nodeName);
                    }
                }

                envKeystore.prototype.setNodeName = function(strName) {
                    this.nodeName = strName;
                    if(this.mainObject) {
                        this.mainObject.loadDetails(this.envId, this.nodeId, this.nodeName);
                    }
                }

                envKeystore.prototype.getComponentPath = function() {
                    return "tibco/admin/environments/keystore/component.xml"
                }

                envKeystore.prototype.buttonSelected = function() {
                    if(!this.isInEditMode()) {
                        this.mainObject.loadDetails(this.envId, this.nodeId, this.nodeName);
                    }
                }
            }
            )
}